#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int maxArea(int* height, int heightSize) {
    int left = 0; int right = heightSize - 1;
    int tmp = 0;
    int max = 0;
    int x = 0, y = 0;
    while (left < right) {
        x = right - left;
        y = height[left] > height[right] ? height[right] : height[left];
        tmp = x * y;
        if (tmp > max)max = tmp;
        if (height[right] > height[left])left++;
        else right++;
    }
    return max;

}
int main()
{
    int arr[] = { 1,8,6,2,5,4,8,3,7 };
    int sz = sizeof(arr) / sizeof(arr[0]);
    int ret = maxArea(arr, sz);

    return 0;
}